<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 员工信息</strong>&emsp;<a
            style="color: #3a4bfb;font-weight: bold " href="javascript:history.go(-1)">返回上一步</a></div>
    <div class="body-content">
        <form class="layui-form" action="{:url('Staffsaves/newstaff')}" method="post">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">姓名：</label>
                    <div class="layui-input-block">
                        <input value="{$list.id}" type="hidden" name="id">
                        <input name="ch_name" lay-verify="required|chinaese" autocomplete="off" placeholder="请输入姓名"
                               value="{$list.ch_name}" class="layui-input" type="text">
                    </div>
                </div>
                <div style="margin-left: 38px" class="layui-inline">
                    <label class="layui-form-label">姓名拼音：</label>
                    <div style="margin-top: 10px;margin-left: 36%" class="layui-input-block">
                        <input name="en_name" lay-verify="required|pinyin" autocomplete="off" value="{$list.en_name}"
                               placeholder="请输入姓名拼音" class="layui-input" type="text">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">角色：</label>
                <div class="layui-input-block">
                    {volist name="role" id="rol"}
                    {if condition="$rol.state eq 1"}
                    <input type="checkbox" checked="checked" title="{$rol.role}" name="{$rol.id}">
                    {else /}
                    <input type="checkbox" title="{$rol.role}" name="{$rol.id}">
                    {/if}
                    {/volist}
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">区域：</label>
                    <div style="padding-left: 10%" class="layui-input-inline">
                        <select lay-verify="required" lay-filter="region_id" id="region_id" name="region_id"
                                lay-search="">
                            <option value="{$list.region_id}">{$list.region}</option>
                        </select>
                    </div>
                </div>
                <div style="margin-left: 2.6%" class="layui-inline">
                    <label class="layui-form-label">部门：</label>
                    <div id="branch" class="layui-input-inline">
                        <select name="branch_id" lay-filter="branch_id" id="branch_id" lay-verify="required"
                                lay-search="">
                            <option value="{$list.branch_id}">{$list.branch}</option>
                        </select>
                    </div>
                </div>

            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">email：</label>
                    <div style="margin-left: 30px" class="layui-input-inline">
                        <input name="email" placeholder="请输入你的邮箱" value="{$list.email}" lay-verify="required|email"
                               autocomplete="off" placeholder="" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">手机：</label>
                    <div style="margin-top: 10px" class="layui-input-inline">
                        <input name="tel" placeholder="请输入手机号" value="{$list.tel}" lay-verify="required|phone" autocomplete="off"
                               class="layui-input" type="tel">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">家庭电话：</label>
                    <div style="margin-top: 10px" class="layui-input-inline">
                        <input name="home_tel" placeholder="请输入家庭电话" value="{$list.home_tel}" lay-verify="number"
                               autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">验证身份证：</label>
                <div class="layui-input-block">
                    <input name="identity_card" value="{$list.identity_card}" placeholder="请输入验证身份证号"
                           lay-verify="identity" placeholder="" autocomplete="off" class="layui-input" type="text">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">密码：</label>
                    <div style="margin-left: 30px" ; class="layui-input-inline">
                        <input disabled="disabled" type="password" value="{$list.password}" placeholder="请输入密码"
                               autocomplete="off" class="layui-input" name="password"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">出生日期：</label>
                    <div style="margin-top: 10px" class="layui-input-inline">
                        <input name="borndata" value="{$list.borndata}" id="borndata" lay-verify="date"
                               placeholder="yyyy-MM-dd" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">性别：</label>
                    <div class="layui-input-inline">
                        <select name="sex" lay-search="">
                            {if condition="$list.sex eq 1"}
                            <option value="0">请选择性别</option>
                            <option selected="selected" value="1">男</option>
                            <option value="2">女</option>
                            {elseif condition="$list.sex eq 2"/}
                            <option value="0">请选择性别</option>
                            <option value="1">男</option>
                            <option selected="selected" value="2">女</option>
                            {else /}
                            <option selected="selected" value="0">请选择性别</option>
                            <option value="1">男</option>
                            <option value="2">女</option>
                            {/if}
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">出生地：</label>
                <div class="layui-input-block">
                    <input name="born" lay-verify="title" value="{$list.born}" autocomplete="off" placeholder="请输入出生地"
                           class="layui-input" type="text">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">户籍地址：</label>
                <div class="layui-input-block">
                    <input name="place_adress" value="{$list.place_adress}" lay-verify="title" autocomplete="off"
                           placeholder="请输入户籍地址" class="layui-input" type="text">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">通讯地址：</label>
                <div class="layui-input-block">
                    <input name="adress" value="{$list.adress}" lay-verify="title" autocomplete="off"
                           placeholder="请输入通讯地址" class="layui-input" type="text">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">户籍邮政编码：</label>
                    <div style="margin-top: 10px" class="layui-input-block">
                        <input name="place_zip_code" value="{$list.place_zip_code}" lay-verify="title"
                               autocomplete="off" placeholder="请输入户籍邮政编码" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">通讯邮政编码：</label>
                    <div style="margin-top: 10px" class="layui-input-block">
                        <input name="zip_code" value="{$list.zip_code}" lay-verify="title" autocomplete="off"
                               placeholder="请输入通讯邮政编码" class="layui-input" type="text">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">学历：</label>
                    <div class="layui-input-block">
                        <input name="education" value="{$list.education}" placeholder="请填写你的学历" lay-verify="title"
                               autocomplete="off" placeholder="" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">政治面貌：</label>
                    <div style="margin-top: 10px" class="layui-input-block">
                        <input name="political_status" value="{$list.political_status}" placeholder="请填写你的政治面貌"
                               lay-verify="title" autocomplete="off" placeholder="" class="layui-input" type="text">
                    </div>
                </div>

            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">紧急联系人：</label>
                    <div class="layui-input-block">
                        <input name="exi_people" value="{$list.exi_people}" lay-verify="title" autocomplete="off"
                               placeholder="请填写你的紧急联系人" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">紧急联系人电话：</label>
                    <div style="margin-top: 10px;padding-left: 11%" class="layui-input-inline">
                        <input name="exi_tel" value="{$list.exi_tel}" placeholder="请填写你的紧急联系人电话" lay-verify="number"
                               autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">与紧急联系人的关系：</label>
                <div class="layui-input-block">
                    <textarea placeholder="请填写本人与紧急联系人的关系" class="layui-textarea"
                              name="relative">{$list.relative}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">健康状况：</label>
                    <div style="margin-top: 10px" class="layui-input-block">
                        <input type="text" value="{$list.condition}" lay-verify="title" placeholder="请填写你的健康状况"
                               class="layui-input" name="condition"/>
                    </div>
                </div>
                <div style="margin-left: 3.5%" class="layui-inline">
                    <label class="layui-form-label">既往病史：</label>
                    <div style="margin-top: 10px;margin-left: 35%" class="layui-input-block">
                        <input type="text" lay-verify="title" placeholder="请填写你的既往病史" class="layui-input"
                               value="{$list.anamnesis}" name="anamnesis"/>
                    </div>
                </div>
                <div style="margin-left: 4%" class="layui-inline">
                    <label class="layui-form-label">婚育情况：</label>
                    <div style="margin-top: 10px" class="layui-input-block">
                        <input type="text" placeholder="请填写你的婚育情况" lay-verify="title" class="layui-input"
                               value="{$list.status}" name="status"/>
                        <div class="tips"></div>
                    </div>
                </div>

            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">相关经验：</label>
                    <div style="margin-left: 30px;margin-top: 10px" class="layui-input-inline">
                        <select name="experience" lay-search="">
                            {if condition="$list.experience eq 1"}
                            <option value="0">请选择是否有经验</option>
                            <option selected="selected" value="1">有</option>
                            <option value="2">无</option>
                            {elseif condition="$list.experience eq 2"/}
                            <option value="0">请选择是否有经验</option>
                            <option value="1">有</option>
                            <option selected="selected" value="2">无</option>
                            {else /}
                            <option selected="selected" value="0">请选择是否有经验</option>
                            <option value="1">有</option>
                            <option value="2">无</option>
                            {/if}
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">入职时间：</label>
                    <div style="margin-top: 10px" class="layui-input-inline">
                        <input name="entry_time" value="{$list.entry_time}" id="entry_time" lay-verify="date"
                               placeholder="yyyy-MM-dd" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">职位：</label>
                    <div class="layui-input-block">
                        <input type="text" placeholder="要担任的职位" lay-verify="required" class="layui-input"
                               value="{$list.position}" name="position"/>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">原社保缴纳至：</label>
                    <div style="margin-top: 10px;margin-left: 30px" class="layui-input-inline">
                        <select name="old_firm" lay-search="">
                            {volist name="month" id="mo"}
                            {if condition="$list.old_firm eq $mo.id"}
                            <option selected="selected" value="{$mo.id}">{$mo.month}</option>
                            {else /}
                            <option value="{$mo.id}">{$mo.month}</option>
                            {/if}
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">是否开户：</label>
                    <div class="layui-input-inline">
                        <select name="need" lay-search="">
                            {if condition="$list.need eq 1"}
                            <option value="0">请选择是否开新户</option>
                            <option selected="selected" value="1">需要</option>
                            <option value="2">不需要</option>
                            {elseif condition="$list.experience eq 2"/}
                            <option value="0">请选择是否开新户</option>
                            <option value="1">需要</option>
                            <option selected="selected" value="2">不需要</option>
                            {else /}
                            <option selected="selected" value="0">请选择是否开新户</option>
                            <option value="1">需要</option>
                            <option value="2">不需要</option>
                            {/if}
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">公积金账号：</label>
                    <div class="layui-input-block">
                        <input type="text" lay-verify="title" placeholder="请输入公积金账号" class="layui-input"
                               value="{$list.account_number}" name="account_number">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">有无熟人在公司：</label>
                    <div style="margin-left: 30px;margin-top: 20px" class="layui-input-inline">
                        <select name="friend" lay-search="">
                            {if condition="$list.need eq 1"}
                            <option value="0">请选择有无熟人在公司</option>
                            <option selected="selected" value="1">有</option>
                            <option value="2">无</option>
                            {elseif condition="$list.experience eq 2"/}
                            <option value="0">请选择有无熟人在公司</option>
                            <option value="1">有</option>
                            <option selected="selected" value="2">无</option>
                            {else /}
                            <option selected="selected" value="0">请选择有无熟人在公司</option>
                            <option value="1">有</option>
                            <option value="2">无</option>
                            {/if}
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">姓名：</label>
                    <div class="layui-input-block">
                        <input lay-verify="title" placeholder="请输入他的名字" class="layui-input" value="{$list.friend_name}"
                               name="friend_name" type="text">
                    </div>
                </div>
                <div style="margin-left: 4%" class="layui-inline">
                    <label class="layui-form-label">所在部门：</label>
                    <div style="margin-top: 10px;margin-left: 35%" class="layui-input-block">
                        <input lay-verify="title" placeholder="请输入他所在部门" class="layui-input"
                               value="{$list.friend_branch}" name="friend_branch" type="text">
                    </div>
                </div>
                <div style="margin-left: 4%" class="layui-inline">
                    <label class="layui-form-label">职位：</label>
                    <div class="layui-input-block">
                        <input lay-verify="title" placeholder="请输入他所担任职位" class="layui-input"
                               value="{$list.friend_position}" name="friend_position" type="text">
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">详述你们的关系：</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" class="layui-textarea"
                              name="friend_relation">{$list.friend_relation}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button name="submit" value="submit" class="layui-btn" lay-submit="" lay-filter="demo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
<script type="text/javascript" src="__JS__/showdate.js"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        //三级联动
        var proid = 0;
        $.getJSON("{:url('Base/liandong_a')}", function (data_a) {
            //console.log(data.datalist);
            $.each(data_a.datalist, function (i, item) {
                if (i == 0) {
                    proid = item.id;
                }
                $('#region_id').append('<option value=' + item.id + '>' + item.region + '</option>');
            });
            $.getJSON("{:url('Base/liandong_b')}?region_id=" + proid, function (data_b) {
                $.each(data_b.datalist, function (i, item) {
                    $('#branch_id').append('<option value=' + item.id + '>' + item.branch + '</option>')
                });
                form.render('select');
            })
        });
        form.on('select(region_id)', function (data_aa) {
            var region_ids = data_aa.value;
            $('#branch_id').html('');
            $.getJSON("{:url('Base/liandong_b')}?region_id=" + region_ids, function (data_bb) {
                $.each(data_bb.datalist, function (i, item) {
                    $('#branch_id').append('<option  value=' + item.id + '>' + item.branch + "</option>");
                });
                form.render('select');
            })
        });
        //日期entry_time
        laydate.render({
            elem: '#borndata'
        });
        laydate.render({
            elem: '#entry_time'
        });
        //监听自定义验证
        form.verify({
            number: [/^([0-9]{3,4}-)?[0-9]{7,8}$/, '请输入正确的座机号码']
            // , numbers: [/^([0-9]{3,4}-)?[0-9]{7,8}|^1\d{10}$/, '请输入正确的座机号码或手机号']
            , pinyin: [/^[A-Za-z]*$/, '请输入拼音']
            ,chinaese:[/^[\u4e00-\u9fa5]{1,10}$/,'请输入汉字']
        });
        //监听提交
        form.on('submit(demo)', function (data_d) {
            // console.log(JSON.stringify(data.field));
            /*layer.alert(JSON.stringify(data.field), {
             title: '最终的提交信息'
             });*/
            var datas = JSON.stringify(data_d.field);
            //console.log(datas);
            var submit = 'submit';
            $.ajax({
                type: "post",
                url: "{:url('Staffsaves/newstaff')}",
                data: {'data': datas, 'submit': submit},
                dataType: "json",
                success: function (res) {
                    //console.log(res);
                    if (res == 1) {
                        layer.msg('修改成功');
                        window.setTimeout("window.location=\"{:url('Stafflist/index')}\"", 2000);
                        //window.location.href="{:url('Stafflist/index')}"
                    } else if (res == 2) {
                        layer.msg('提示：邮箱格式不正确');
                    } else if (res == 3) {
                        layer.msg('提示：中文或英文用户名已被使用');
                    } else if (res==4){
                        layer.msg('提示：邮箱已被使用');
                    } else if (res==5){
                        layer.msg('提示：手机号已被使用');
                    }else {
                        layer.msg('提示：用户修改失败');
                    }
                }
            });
            return false;
        });

    })
</script>
</html>